import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Login from  "../views/Login.vue"
import Main2 from '../views/Main2.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',  //  首页 访问 路由
    name: 'Login',
    component: Login,
  },
  {
    path: '/register',  //  首页 访问 路由
    name: 'Register',
    component:  ()=>import('../views/Register.vue')
  },
  {
    path: '/Main',
    name: 'Main',
    component: ()=>import('../views/Main.vue'),
    children:[
      {
        path: '/AddGoods',
        name: 'AddGoods',
        component: ()=>import('../views/AddGoods.vue')
      },
      {
        path: '/AddAddress',
        name: 'AddAddress',
        component: ()=>import('../views/AddAddress.vue')
      },
      {
        path: '/AddNews',
        name: 'AddNews',
        component: ()=>import('../views/AddNews.vue')
      },
      {
        path: '/QueryGoods',
        name: 'QueryGoods',
        component: ()=>import('../views/QueryGoods.vue')
      },
      {
        path: '/QueryAddress',
        name: 'QueryAddress',
        component: ()=>import('../views/QueryAddress.vue')
      },
      {
        path: '/QueryNews',
        name: 'QueryNews',
        component: ()=>import('../views/QueryNews.vue')
      }
    ]
  },
  {
    path: '/main2',
    name: 'Main2',
    component: Main2,
  }

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
